package test;

//空格替换
public class topic04 {
    public static void main(String[] args) {
        replaceSpace("zhangaiyu ni ma si le",21);
    }
    public static String replaceSpace(String iniString, int length) {
        // write code here
        if (iniString != null || length != 0){
            return iniString;
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            char c = iniString.charAt(i);
            if (c==' '){
                sb.append("%20");
            }else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
}
